//GENERA ENTRADAS PARA EL PROBLEMA 4 Y LAS GUARDA EN EL ARCHIVO entrada.txt

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <time.h>

using namespace std;

int main(){
	srand (time(NULL));
	int l;
	int n;
	int m;
	int c;
	ofstream myfile;

	cin >> n;
	cin >> m;
	cin >> c;

	
  myfile.open ("entradas");

	
    myfile << n << " " << m << " " << c << endl;
	  
    for (int h = 0; h < n*m; h++)
    {
      for (int z = 0; z < 4; z++)
      {
	int q = rand() % (c) + 1;
	myfile << q << " ";
      }
      myfile << endl;
      
    }
		
	
 

  myfile.close();
  return 0;
}

